var gulp=require("gulp");
var cm=require("gulp-cssmin");
var js=require("gulp-uglify");
var rename=require("gulp-rename");
var babel = require('gulp-babel');
var imgmin = require('gulp-tinypng-nokey');


gulp.task("perfect",(done)=>{
	gulp.src("src/*/*.css")
		.pipe(cm())
		.pipe(gulp.dest("dist"))
		
	gulp.src("src/*/*.js")
		.pipe(babel({
			presets: ['env']
		}))
		.pipe(js())
		.pipe(gulp.dest("dist"))
	
	
	gulp.src("src/*/*/*.{jpg,png,gif,jpeg,webp}")
		.pipe(imgmin())
		.pipe(gulp.dest("dist"))

	gulp.src("src/*/*.{jpg,png,gif,jpeg,webp}")
		.pipe(imgmin())
		.pipe(gulp.dest("dist"))
		
	gulp.src("src/*.{html,php,ico}")
		.pipe(gulp.dest("dist"))
	
	gulp.src("src/*/*.{json,ttf,html,woff,woff2}")
		.pipe(gulp.dest("dist"))

		done();
})
